const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}


module.exports = {
  chainWebpack: config => {
    // 修改prefetch,优化路由懒加载：
    config.plugin('prefetch').tap(options => {
      options[0].fileBlacklist = options[0].fileBlacklist || []
      options[0].fileBlacklist.push(/myasyncRoute(.)+?\.js$/)
      return options
    })

    //为路径起别名，方便文件的导入，如果是在js中import导入，直接from 'views/'
    // 如果是在html标签中导入，别名前面要加~,<img src="~assets/">
    config.resolve.alias
      .set('components', resolve('src/components'))
      .set('assets', resolve('src/assets'))
      .set('views', resolve('src/views'))
  },

  //线上实际项目路径
  publicPath: '/vuejs1/'
}